需要幫助試圖找出如何以編程方式刪除的影像風格在Drupal 7如何以編程方式刪除Drupal中的圖像樣式?
4
A
回答
5
$image_style = image_style_load('IMAGE_STYLE');
image_style_delete($image_style);
見https://api.drupal.org/api/drupal/modules!image!image.module/function/image_style_delete/7
您可能需要刷新圖像樣式緩存之前它會告訴你刪除它。你可以做到這一點:
image_style_flush($image_style);
欲瞭解更多信息,請參見:
3
<?php
// Load the style.
$style = image_style_load('styleName');
// Flush images associated with the style.
image_style_flush($style);
// Delete the style.
image_style_delete($style);
?>
這不會對默認樣式的工作。建議不要刪除它們,因爲很多Drupal模塊都依賴於它。
更新:
如果你已經修改了默認樣式(縮略圖,中,大),你不能刪除它們。相反,你可以將它們恢復到原來的設置,就像這樣。
<?php
// Load the style.
$style = image_style_load('styleName');
// Flush images associated with the style.
image_style_flush($style);
// Revert the style.
image_default_style_revert($style);
?>
相關問題
- 1. Drupal以編程方式刪除JavaScript
- 2. 如何以編程方式刪除drupal中的論壇評論?
- 3. 如何以編程方式刪除AlertDialog
- 4. 如何以編程方式刪除plist?
- 5. 如何以編程方式刪除layout_marginStart
- 6. 以編程方式編輯Drupal節點中的圖像
- 7. Drupal 8 - 如何以編程方式調整圖像大小?
- 8. 如何以編程方式將圖像添加到Drupal節點?
- 9. 如何在Chrome中刪除以編程方式添加的樣式?
- 10. 以編程方式從WordPress中刪除圖像
- 11. 我想以編程方式從照片庫中刪除圖像?
- 12. 在Python中以編程方式剪切圖像/刪除背景
- 13. 以編程方式從html中刪除圖像和視頻
- 14. Drupal:以編程方式保存圖像場圖像
- 15. 如何在Android中以編程方式刪除圖片?
- 16. 如何以編程方式從NSCustom視圖中刪除NSButton?
- 17. 如何以編程方式從視圖3中刪除字段?
- 18. 如何以編程方式在Drupal 8中清除緩存
- 19. 如何以編程方式刪除MySQL視圖的列?
- 20. 如何以編程方式刪除控件的視圖狀態?
- 21. 如何以編程方式渲染Drupal 7中的Openlayers地圖
- 22. 以編程方式從android中的圖像視圖中刪除背景圖片
- 23. 如何以編程方式從「可繪製」文件夾中刪除圖像?
- 24. 如何以編程方式從「可繪製」文件夾中刪除圖像?
- 25. 如何以編程方式刪除系統圖像應用程序?
- 26. 以內聯樣式刪除樣式寬度圖像php
- 27. 如何以編程方式從log4j2中的logger中刪除appender?
- 28. 如何以編程方式刪除圖標(Android)
- 29. 如何以編程方式刪除PDF圖層?
- 30. iPhone:如何以編程方式刪除按鈕背景圖片?
注* image_style_delete()中的代碼自動調用image_style_flush()。 @see https://api.drupal.org/api/drupal/modules!image!image.module/function/image_style_delete/7 – relipse